home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 37 / Amiga Format CD37 (1999-02-16)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-03].iso / -screenplay- / shareware / invasionforce / source / misc / compile_shipnames.rexx < prev    next >
OS/2 REXX Batch file  |  1999-01-09  |  920b  |  39 lines

  1.  
  2. /*
  3.    compile_shipnames.rexx - read the given text file of ship names and
  4.    translate them into a form more easily digestible by Invasion Force
  5. */
  6.  
  7. parse arg filename
  8. if filename='' then
  9.    filename='ship_names.text'
  10. if ~open('infile',filename,'r') then do
  11.    say "Sorry, can't read" filename "."
  12.    exit
  13. end
  14. line=readln('infile')
  15. fileopen=0
  16. do while ~eof('infile')
  17.    if left(line,1)='*' then do
  18.       if fileopen then
  19.          call close('outfile')
  20.       line='NAMES.'||right(line,length(line)-1)
  21.       say 'Processing' line
  22.       if exists(line) then
  23.          address command "delete >nil: "||line
  24.       fileopen=open('outfile',line,'w')
  25.    end
  26.    else
  27.       if fileopen then do
  28.          say '   '||line
  29.          call writeln('outfile',substr(line,1,19,'00'X))
  30.       end
  31.    line=readln('infile')
  32. end
  33. if fileopen then
  34.    call close('outfile');
  35. say 'Processing of ship names is completed!'
  36. exit
  37.  
  38. /* end of listing */
  39.